<?php
namespace app\common\model;

use think\Model;

class Ad extends Model
{
    protected $autoWriteTimestamp =true;
    protected $type = [
        'create_time'  =>  'timestamp:Y/m/d H:i:s',
        'update_time'  =>  'timestamp:Y/m/d H:i:s',
        'totime'  =>  'timestamp:Y/m/d H:i:s',
        'endtime'  =>  'timestamp:Y/m/d H:i:s',
    ];
    
    public function place(){
        return $this->hasOne('AdPlace','id','pid');
    }
    
    public function seller(){
        return $this->hasOne('Company','user_id','user_id')->field('thumb,user_id,company,is_club,validated');
    }

}